package bud.web.boardqa.dao;

import java.util.List;

import org.springframework.orm.ibatis.SqlMapClientTemplate;

import bud.vo.BoardFormDTO;
import bud.vo.BoardQADTO;

public class BoardqaDaoiBatis implements IBoardqaDao {

	private SqlMapClientTemplate mapper;
	
	public SqlMapClientTemplate getMapper() {
		return mapper;
	}

	public void setMapper(SqlMapClientTemplate mapper) {
		this.mapper = mapper;
	}
	
	@Override
	public List<BoardQADTO> getBoardqaList(BoardFormDTO formDTO) {
		return mapper.queryForList("Boardqa.getBoardqaList", formDTO);
	}

	@Override
	public int getBoardqaCount(BoardFormDTO formDTO) {
		return (int) mapper.queryForObject("Boardqa.getBoardqaCount", formDTO);
	}

	@Override
	public BoardQADTO getBoardqa(Integer qa_no) {
		return (BoardQADTO) mapper.queryForObject("Boardqa.getBoardqa", qa_no);
	}

	@Override
	public int insertBoardqa(BoardQADTO boardqa) {
		return (int) mapper.insert("Boardqa.insertBoardqa", boardqa);
	}

	@Override
	public int updateBoardqa(BoardQADTO boardqa) {
		return mapper.update("Boardqa.updateBoardqa", boardqa);
	}

	@Override
	public int deleteBoardqa(Integer qa_no) {
		return mapper.delete("Boardqa.deleteBoardqa", qa_no);
	}

	@Override
	public int getBoardqaDepthCount(BoardQADTO boardqa) {
		return (int) mapper.queryForObject("Boardqa.getBoardqaDepthCount", boardqa);
	}

}
